<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use think\Env;

class Index extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function index()
    {
        $path = '../public/285321190';
        $files =$this-> getImgList($path);
        $url = Env::get('app.domain');
        foreach ($files as $key=>$value){
            $files[$key] = $url.'/285321190/'.$value;
        }
        $this->view->assign('file', $files);
        return $this->view->fetch();
    }

    //获取图片文件列表函数
    public  function getImgList($dir)
    {
        if(is_dir($dir)){
            $file_dir = scandir($dir);
            unset($file_dir[0]);
            unset($file_dir[1]);
        }
        return $file_dir;
    }

}
